# Maintainer: AlexWMF <alexxwmf@gmail.com>

_realname=gst-plugins-ugly
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.18.4
pkgrel=1
pkgdesc="GStreamer Multimedia Framework Ugly Plugins (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://gstreamer.freedesktop.org/"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-gtk-doc"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-ninja"
             "${MINGW_PACKAGE_PREFIX}-libcdio>=2.1.0-2")
depends=("${MINGW_PACKAGE_PREFIX}-a52dec"
         "${MINGW_PACKAGE_PREFIX}-gst-plugins-base"
         "${MINGW_PACKAGE_PREFIX}-libcdio"
         "${MINGW_PACKAGE_PREFIX}-libdvdread"
         "${MINGW_PACKAGE_PREFIX}-libmpeg2"
         "${MINGW_PACKAGE_PREFIX}-opencore-amr"
         "${MINGW_PACKAGE_PREFIX}-x264")
source=(${url}/src/${_realname}/${_realname}-${pkgver}.tar.xz)
sha256sums=('218df0ce0d31e8ca9cdeb01a3b0c573172cc9c21bb3d41811c7820145623d13c')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"

}

build() {
  [[ -d "${srcdir}/build-${MINGW_CHOST}" ]] && rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}" && cd "${srcdir}/build-${MINGW_CHOST}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  ${MINGW_PREFIX}/bin/meson.exe \
    --prefix="${MINGW_PREFIX}" \
    --buildtype plain \
    --wrap-mode=nofallback \
    -Dauto_features=enabled \
    -Dpackage-origin='https://www.msys2.org' \
    -Dtests=disabled \
    -Dsidplay=disabled \
    -Ddoc=disabled \
    ../${_realname}-${pkgver}

  ${MINGW_PREFIX}/bin/ninja.exe
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"

  DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/ninja.exe install

  rm -f ${pkgdir}${MINGW_PREFIX}/lib/gstreamer*/*.a
}
